package com.example.newbook.service.impl;

import com.example.newbook.entity.Category;
import com.example.newbook.mapper.CategoryMapper;
import com.example.newbook.service.CategoryService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;


@Service
@Transactional(rollbackFor = {Exception.class})
public class CategoryServiceImpl implements CategoryService {


    @Resource
    private CategoryMapper categoryMapper;


    @Transactional(readOnly = true,propagation = Propagation.SUPPORTS,rollbackFor = {Exception.class})
    @Override
    public Category findCategoryById(int id) {
        return categoryMapper.getCategoryById(id);
    }
}
